package com.one.rope.mvp.web.controller.admin;

import com.one.rope.mvp.basecore.annotation.LogMethod;
import com.one.rope.mvp.web.business.service.IMemberIntentionLogService;
import com.one.rope.mvp.web.common.dto.admin.intention.AdminIntentionListDTO;
import com.one.rope.mvp.web.common.dto.admin.intention.AdminIntentionListItemVO;
import com.one.rope.mvp.basecore.bean.ResponseObject;
import com.one.rope.mvp.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Weijian.Liu
 * @desc 管理后台-用户意向数据控制器
 * @date 2020/2/20 22:50
 */
@Api(tags = "A5管理后台-意向数据模块")
@RestController
@RequestMapping("/admin/api")
@Slf4j
public class AdminMemberIntentionController extends BaseController {

  @Autowired
  IMemberIntentionLogService memberIntentionLogService;

  @LogMethod
  @ApiOperation(value = "001意向数据列表", notes = "意向数据列表接口", response = AdminIntentionListItemVO.class)
  @PostMapping("/intention/intentionList")
  public ResponseObject intentionList(@RequestBody AdminIntentionListDTO reuestDTO) {
    try {
      return memberIntentionLogService.intentionList(reuestDTO);
    } catch (Exception e) {
      log.error("/admin/api/intention/intentionList接口异常", e);
      return ResponseObject.systemError(e);
    }
  }
}
